#ifndef __WIZ_BNF_PARSER_ALTERNATIVE_HPP__SHANHAOBO_19800429__
#define __WIZ_BNF_PARSER_ALTERNATIVE_HPP__SHANHAOBO_19800429__

#include "./WizBNFParserBinary.hpp"

namespace Wiz
{
    namespace BNF
    {
        namespace Parser
        {
            namespace Alternative
            {
                template <typename LeftT, typename RightT>
                struct Type : public ::Wiz::BNF::Parser::Binary::Type<LeftT, RightT, ::Wiz::BNF::Parser::Type<Type<LeftT, RightT>>>
                {
                    typedef Type<LeftT, RightT>                                                                             tThis;
                    typedef ::Wiz::BNF::Parser::Binary::Type<LeftT, RightT, ::Wiz::BNF::Parser::Type<Type<LeftT, RightT>>>  tSuper;

                    Type(LeftT const& Lft, RightT const& Rght) : tSuper(Lft, Rght)
                    {}

                    template <typename ScannerT>
                    typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType
                    ParseImpl(ScannerT const& Scan) const
                    {
                        typedef typename ::Wiz::BNF::Parser::Result<tThis, ScannerT>::tType tResult;
                        tResult Rslt = this->Left().Parse(Scan);
                        if (Rslt.IsValid())
                        {
                            return Rslt;
                        }
                        return this->Right().Parse(Scan);
                    }
                }; /// end of struct Type
            } /// end of namespace Alternative
        } /// end of namespace Parser
    } /// end of namespace BNF
} /// end of namespace Wiz

#endif /*__WIZ_BNF_PARSER_ALTERNATIVE_HPP__SHANHAOBO_19800429__*/
